package csel.model;

import junit.framework.Assert;
import junit.framework.TestCase;

import org.junit.After; 
import org.junit.Before; 
import org.junit.Test; 


public class TerrainTester extends TestCase{
	Wall wall;
	Floor floor;
	Desk desk;
	Entity e;
	public static void main(String args[]) 
	{ 
		junit.textui.TestRunner.run(MapTester.class); 
	} 
	
	@Before
	protected void setUp() throws Exception
	{
		e = new Entity(new Smasher());
		wall = new Wall();
		floor = new Floor();
		desk = new Desk();
	}
	
	@Test
	public void testTerrain()
	{
		//should be true
		Assert.assertEquals(true, floor.canPass(e));
	
		boolean canPass = false;
		e.setCanClimb(canPass);
		
		//both should be false
		Assert.assertEquals(canPass, wall.canPass(e));
		
		canPass = true;
		e.setCanClimb(canPass);
		//both should be true
		Assert.assertEquals(canPass, wall.canPass(e));
		
		e.setCanSwim(canPass);
		//both should be true
		Assert.assertEquals(canPass, desk.canPass(e));
		
		canPass = false;
		e.setCanSwim(canPass);
		//both should be false
		Assert.assertEquals(canPass, desk.canPass(e));
		
		canPass = true;
		//should be true
		Assert.assertEquals(canPass, floor.canPass(e));
		
	}
	@After protected void tearDown() throws Exception 
	{ 
		super.tearDown();
		wall = null;
		floor =null;
		desk = null;
	} 
}
